﻿using ERP.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Features;
using Volo.Abp.Localization;
using Volo.Abp.Validation.StringValues;

namespace ERP.Permissions
{

    public class ERPPermissionDefinitionProvider : PermissionDefinitionProvider
    {
        public override void Define(IPermissionDefinitionContext context)
        {
            var erpGroup = context.AddGroup(ERPPermissions.GroupName);
            //Define your own permissions here. Example:
            //  myGroup.AddPermission(ERPPermissions.MyPermission1, L("Permission:MyPermission1"));

            //工作台
            var workGroup = erpGroup.AddPermission(ERPPermissions.Work, L("Menu:Work"));
            workGroup.AddChild(ERPPermissions.Home, L("Menu:Home"));
            workGroup.AddChild(ERPPermissions.StartFlow, L("Menu:StartFlow"));
            workGroup.AddChild(ERPPermissions.Todo, L("Menu:Todo"));
            workGroup.AddChild(ERPPermissions.Todoed, L("Menu:Todoed"));
            workGroup.AddChild(ERPPermissions.MyApply, L("Menu:MyApply"));
            workGroup.AddChild(ERPPermissions.MyCirculated, L("Menu:MyCirculated"));
            workGroup.AddChild(ERPPermissions.Readed, L("Menu:Readed"));

            //系统管理
            var systeMmanager = erpGroup.AddPermission(ERPPermissions.SysteMmanager, L("Menu:SysteMmanager"));
            systeMmanager.AddChild(ERPPermissions.UserMmanager, L("Menu:UserMmanager"));
            systeMmanager.AddChild(ERPPermissions.RoleMmanager, L("Menu:RoleMmanager"));
            systeMmanager.AddChild(ERPPermissions.TenantMmanager, L("Menu:TenantMmanager"));
            systeMmanager.AddChild(ERPPermissions.OrgMmanager, L("Menu:OrgMmanager"));

 

        }

        private static LocalizableString L(string name)
        {
            return LocalizableString.Create<ERPResource>(name);
        }
    }


 
}
